package com.yjd.bi.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.BeansException;

import com.yjd.bi.report.model.BiDatabaseInfoModel;
import com.yjd.bi.report.model.DataChangeRecordModel;

/**
 * <b>description</b>：业务库数据抽取 <br>
 * <b>time</b>：2016-4-11下午2:28:19 <br>
 * <b>author</b>： ready likun_557@163.com
 */
public interface IDataChangeRecordTrsService {

	/**
	 * 将业务库数据变更日志已到bi库
	 * 
	 * @param dsm
	 * @throws Exception
	 */
	public void moveDcrmFromBusDsToBiDs(final BiDatabaseInfoModel dsm)
			throws Exception;

	/**
	 * 将业务库中已处理的变更记录移到日志库
	 * 
	 * @param dsm
	 * @throws Exception
	 */
	public void moveBusDbDcrmToDcrmLogs(BiDatabaseInfoModel dsm)
			throws Exception;

	/**
	 * 将业务库中已处理的变更记录移到日志库
	 * 
	 * @param dsm
	 *            数据库
	 * @param list
	 *            需要转移变更记录列表
	 */
	public void moveBusDbDcrmToDcrmLogs(BiDatabaseInfoModel dsm,
			List<DataChangeRecordModel> list) throws Exception;

	/**
	 * 将m从dsm库中变更记录表移到变更日志表
	 * 
	 * @param dsm
	 *            数据库
	 * @param m
	 *            需要转移的变更记录
	 */
	public void moveBusDbDcrmToDcrmLog(BiDatabaseInfoModel dsm,
			final DataChangeRecordModel m) throws Exception;

	/**
	 * 将dsm库中的dm记录移到bi库,并更新业务库数据为完成状态
	 * 
	 * @param dsm
	 * @param dm
	 * @throws Exception
	 * @throws BeansException
	 */
	public void moveDcrmToBiDsAndSetDcrmSuccess(BiDatabaseInfoModel dsm,
			DataChangeRecordModel dcrm) throws Exception;

	/**
	 * 将dsm库中的dm记录移到bi库
	 * 
	 * @param dsm
	 * @param dm
	 * @throws Exception
	 * @throws BeansException
	 */
	public void moveDcrmToBiDs(BiDatabaseInfoModel dsm,
			DataChangeRecordModel dcrm) throws Exception;

	/**
	 * 将业务库中数据记录状态变更为完成状态
	 * 
	 * @param dsm
	 *            业务库
	 * @param id
	 *            数据变更日志记录，表yjd_data_change_record.id
	 * @return
	 * @throws Exception
	 */
	public int updateBiDatabaseInfoModelToSuccess(BiDatabaseInfoModel dsm,
			long id) throws Exception;

	/**
	 * 获取业务库中数据变更记录
	 * 
	 * @param dsm
	 *            业务库
	 * @param paramMap
	 *            参数
	 * @param page
	 *            第几页
	 * @param pageSize
	 *            每页多少条
	 * @return
	 * @throws Exception
	 */
	public List<DataChangeRecordModel> getChangeRecordModels(
			BiDatabaseInfoModel dsm, Map<String, Object> paramMap, int page,
			int pageSize) throws Exception;

}
